package com.yanqu.road.server.manger.union.listener;

import com.yanqu.road.entity.enums.eUnionSyncType;
import com.yanqu.road.entity.union.cross.CrossUnionInfo;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.manger.ICrossUnionSyncListener;
import com.yanqu.road.server.manger.activity.dragonboatrace.DragonBoatRaceMgr;
import com.yanqu.road.server.manger.beautyescort.BeautyEscortMgr;

import java.util.ArrayList;
import java.util.List;

/**
 * 赛龙舟
 */
public class DragonBoatRaceListener implements ICrossUnionSyncListener {

    @Override
    public void notifySync(int syncType, long playerId, CrossUnionInfo unionInfo, List<CrossUnionMember> memberList) {

        if (syncType == eUnionSyncType.CreateUnion.getValue()) {
            DragonBoatRaceMgr.syncPlayerRedPoint(playerId);
        } else if (syncType == eUnionSyncType.QuitUnion.getValue()) {
            // 取消红点
            DragonBoatRaceMgr.syncPlayerRedPoint(playerId, false);
        } else if (syncType == eUnionSyncType.DeleteUnion.getValue()) {
            for (CrossUnionMember item : memberList){
                // 取消红点
                DragonBoatRaceMgr.syncPlayerRedPoint(item.getUserId(), false);
            }
        } else if (syncType == eUnionSyncType.JoinUnion.getValue()) {
            DragonBoatRaceMgr.syncPlayerRedPoint(playerId);
        } else if (syncType == eUnionSyncType.BeKick.getValue()) {
            DragonBoatRaceMgr.syncPlayerRedPoint(playerId);
        } else if (syncType == eUnionSyncType.UpGrade.getValue()) {
            DragonBoatRaceMgr.unionLevelUp(unionInfo.getUnionUid());
        }

    }
}
